home *** CD-ROM | disk | FTP | other *** search
/ Internet News 2001 December / Internet News 2001-12 - CD-ROM.rar / INCD200112.ISO / Windows / Browser / Internet Explorer 6 / English / iew2k_3.cab / shdoclc.dll / HTML / ANALYZE.DLG < prev    next >
Text File  |  2001-08-17  |  9KB  |  238 lines

  1. <HTML id=dlgAnalyze STYLE="font-family: MS Shell Dlg; font-size: 8pt;
  2. width: 30em; height: 33em">
  3. <HEAD>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. <META HTTP-EQUIV="MSThemeCompatible" CONTENT="Yes">
  6. <TITLE id=dialogTitle>
  7. Analyze Document
  8. </TITLE>
  9. <SCRIPT LANGUAGE="JavaScript" defer>
  10. window.onerror = HandleError
  11. function HandleError(message, url, line)
  12. {
  13. var L_Dialog_ErrorMessage = "An error has occured in this dialog.";
  14. var L_ErrorNumber_Text = "Error: ";
  15. var str = L_Dialog_ErrorMessage + "\n\n"
  16. + L_ErrorNumber_Text + line + "\n"
  17. + message;
  18. alert (str);
  19. window.close();
  20. return true;
  21. }
  22. function otherDocument()
  23. {
  24. return window.dialogArguments.document;
  25. }
  26. function loadBdy()
  27. {
  28. document.all.btnOk.onclick = new Function("window.close();");
  29. document.onkeyup = new Function("documentOnKeyUp()");
  30. runAnalysis();
  31. }
  32. function documentOnKeyUp()
  33. {
  34. if (window.event.keyCode == 27)
  35. {
  36. window.close();
  37. }
  38. }
  39. function runAnalysis()
  40. {
  41. var errorsFound, reportLocation;
  42. errorsFound = false;
  43. reportLocation = document.all.ReportArea;
  44. initializeResults(reportLocation);
  45. errorsFound = errorsFound || checkBodyWithinFrameset(reportLocation);
  46. errorsFound = errorsFound || checkAnythingAfterFrameset(reportLocation);
  47. errorsFound = errorsFound || checkUnloadedComponents(reportLocation);
  48. errorsFound = errorsFound || checkNonApartmentControls(reportLocation);
  49. errorsFound = errorsFound || checkUnloadedStyleSheets(reportLocation);
  50. if (errorsFound == false) {
  51. reportNothingFound(reportLocation);
  52. }
  53. }
  54. function initializeResults(reportLocation)
  55. {
  56. reportLocation.innerHTML = " ";
  57. }
  58. function reportNothingFound(reportLocation)
  59. {
  60. var L_NoErrors_Text = "No errors found.";
  61. reportLocation.innerHTML = L_NoErrors_Text;
  62. }
  63. function checkBodyWithinFrameset(reportLocation)
  64. {
  65. var theDocument;
  66. var framesets, bodies;
  67. var retVal;
  68. var L_FramesetInBody_Text = "This document might not display properly because there is a FRAMESET within the BODY of the document. The page author can resolve this problem by<OL><li>Removing the BODY tag.</li><li>Insuring that there is no additional HTML code between the HEAD of the document and the FRAMESET.</li></ol><br><hr>";
  69. retVal = false;
  70. theDocument = otherDocument();
  71. framesets = theDocument.all.tags("frameset");
  72. if (framesets.length > 0) {
  73. bodies = theDocument.all.tags("body");
  74. if (bodies.length > 0) {
  75. reportLocation.insertAdjacentHTML("BeforeEnd", L_FramesetInBody_Text );
  76. retVal = true;
  77. }
  78. }
  79. return retVal;
  80. }
  81. function checkAnythingAfterFrameset(reportLocation)
  82. {
  83. var L_ContentAfterFrameset_Text = "This document might not display properly because there is content after the FRAMESET.<br><hr>";
  84. var theDocument;
  85. var framesets;
  86. var i, startIndex;
  87. var retVal;
  88. retVal = false;
  89. theDocument = otherDocument();
  90. framesets = theDocument.all.tags("frameset");
  91. if (framesets.length > 0) {
  92. startIndex = framesets(0).sourceIndex;
  93. if (window.dialogArguments.anythingAfterFrameset) {
  94. reportLocation.insertAdjacentHTML("BeforeEnd", L_ContentAfterFrameset_Text );
  95. retVal = true;
  96. }
  97. }
  98. return retVal;
  99. }
  100. function checkUnloadedComponents(reportLocation)
  101. {
  102. var theDocument;
  103. var objects, applets, embeds;
  104. var retVal;
  105. retVal = false;
  106. theDocument = otherDocument();
  107. objects = theDocument.all.tags("object");
  108. applets = theDocument.all.tags("applet");
  109. embeds = theDocument.all.tags("embed");
  110. retVal = checkReadyStateComplete(objects, reportLocation);
  111. retVal = retVal || checkReadyStateComplete(applets, reportLocation);
  112. retVal = retVal || checkReadyStateComplete(embeds, reportLocation);
  113. return retVal;
  114. }
  115. function checkReadyStateComplete(objects, reportLocation)
  116. {
  117. var L_ObjectNotInstalled_Text = "The following OBJECT did not install properly.<BR>";
  118. var L_AppletNotInstalled_Text = "The following APPLET did not install properly.<BR>";
  119. var L_EmbedNotInstalled_Text = "The following EMBED did not install properly.<BR>";
  120. var L_ObjectNotInstalledReasons_Text = "<br><br>This might have been caused by one of the following conditions:<OL><LI>Your current security settings prevent this OBJECT from being used.</li><li>This OBJECT was not properly installed on your computer.</li><li>The page or OBJECT was authored incorrectly.</li></ul><hr>";
  121. var L_AppletNotInstalledReasons_Text = "<br><br>This might have been caused by one of the following conditions:<OL><LI>Your current security settings prevent this APPLET from being used.</li><li>This APPLET was not properly installed on your computer.</li><li>The page or APPLET was authored incorrectly.</li></ul><hr>";
  122. var L_EmbedNotInstalledReasons_Text = "<br><br>This might have been caused by one of the following conditions:<OL><LI>Your current security settings prevent this EMBED from being used.</li><li>This EMBED was not properly installed on your computer.</li><li>The page or EMBED was authored incorrectly.</li></ul><hr>";
  123. var strNotInstalled;
  124. var strNotInstalledReason;
  125. var i, element;
  126. var retVal;
  127. retVal = false;
  128. if (objects == null)
  129. return retVal;
  130. for (i=0; i < objects.length; i++) {
  131. element = objects(i);
  132. if (element.readyState != 4 && element.readyState != "complete") {
  133. switch (element.tagName.toLowerCase())
  134. {
  135. case "object":
  136. strNotInstalled = L_ObjectNotInstalled_Text;
  137. strNotInstalledReason = L_ObjectNotInstalledReasons_Text;
  138. break;
  139. case "applet":
  140. strNotInstalled = L_AppletNotInstalled_Text;
  141. strNotInstalledReason = L_AppletNotInstalledReasons_Text;
  142. break;
  143. case "embed":
  144. strNotInstalled = L_EmbedNotInstalled_Text;
  145. strNotInstalledReason = L_EmbedNotInstalledReasons_Text;
  146. break;
  147. }
  148. reportLocation.insertAdjacentHTML("BeforeEnd", strNotInstalled);
  149. reportLocation.insertAdjacentText("BeforeEnd", element.outerHTML);
  150. reportLocation.insertAdjacentHTML("BeforeEnd", strNotInstalledReason);
  151. retVal = true;
  152. }
  153. }
  154. return retVal;
  155. }
  156. function checkNonApartmentControls(reportLocation)
  157. {
  158. var L_ObjectNotApartmentModel_Text = "The following OBJECT may not work reliably in all circumstances because it doesn't use the Apartment threading model.<br>";
  159. var theDocument;
  160. var objects;
  161. var i;
  162. var retVal;
  163. retVal = false;
  164. theDocument = otherDocument();
  165. objects = theDocument.all.tags("object");
  166. for (i=0; i < objects.length; i++) {
  167. element = objects(i);
  168. nonApartmentModel = checkCLSIDForNonApartmentModel(element);
  169. retVal = retVal || nonApartmentModel;
  170. if (nonApartmentModel == true) {
  171. reportLocation.insertAdjacentHTML("BeforeEnd", L_ObjectNotApartmentModel_Text);
  172. reportLocation.insertAdjacentText("BeforeEnd", element.outerHTML);
  173. reportLocation.insertAdjacentHTML("BeforeEnd", "<br><hr>");
  174. }
  175. }
  176. return retVal;
  177. }
  178. function checkCLSIDForNonApartmentModel(element) {
  179. return !(window.dialogArguments.isApartmentModel(element));
  180. }
  181. function checkUnloadedStyleSheets(reportLocation)
  182. {
  183. var theDocument;
  184. var links;
  185. var retVal;
  186. retVal = false;
  187. theDocument = otherDocument();
  188. links = theDocument.all.tags("link");
  189. retVal = checkLinkReadyStateComplete(links, reportLocation);
  190. return retVal;
  191. }
  192. function checkLinkReadyStateComplete(objects, reportLocation)
  193. {
  194. var i, element;
  195. var retVal;
  196. var L_StyleSheetNotInstalled_Text = "This document might not display properly because the following style sheet did not get installed: ";
  197. retVal = false;
  198. if (objects == null)
  199. return retVal;
  200. for (i=0; i < objects.length; i++) {
  201. element = objects(i);
  202. if (element.rel.toLowerCase() == "stylesheet"
  203. || element.rel.toLowerCase() == "alternate stylesheet")
  204. {
  205. if (element.readyState != "complete" && element.readyState != 4) {
  206. reportLocation.insertAdjacentHTML("BeforeEnd", L_StyleSheetNotInstalled_Text + element.href + "<BR><hr>");
  207. retVal = true;
  208. }
  209. }
  210. }
  211. return retVal;
  212. }
  213. </SCRIPT>
  214. </HEAD>
  215. <BODY ID=bdy onLoad="loadBdy()" style="font-family: 'MS Shell Dlg';
  216. font-size: 8pt; background: threedface; color: windowtext;"
  217. topmargin=0 scroll=no>
  218. <br id=brAnalysis>  Analysis of current document:<br>
  219. <br>
  220. <DIV id=ReportArea style="height: 75%; width: 93%;
  221. position: absolute; left: 5%; top: 12%; overflow: auto; padding: 3px;
  222. border-style: solid; border-width: 1px; border-color: threeddarkshadow">
  223. No errors found.
  224. </DIV>
  225. <br id=br2><P id=par1> </P>
  226. <DIV id=divButton style="font-family: MS Shell Dlg; font-size: 8pt;
  227. width: 8em; height: 2.2em; position: absolute;
  228. top: 27.1em; left: 20em; background: threedface;">
  229. </DIV>
  230. <BUTTON id=btnOk tabIndex=55
  231. style="font-family: MS Shell Dlg; font-size: 8pt;
  232. width: 7em; height: 2.2em; position: absolute;
  233. top: 27.5em; left: 21em" type=submit>
  234. OK
  235. </BUTTON>
  236. </BODY>
  237. </HTML>
  238.